package com.fanchuan.uzx.list.lecture;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.fanchuan.uzx.R;
import com.fanchuan.uzx.db.LectureDB;
import com.googlecode.androidannotations.annotations.EViewGroup;
import com.googlecode.androidannotations.annotations.ViewById;

@EViewGroup(R.layout.uzx_offer_list_item)
public class LectureItemView extends LinearLayout {

	@ViewById
	TextView tvOfferTitle, tvInfoDate;
	
	private static final SimpleDateFormat formate = new SimpleDateFormat("yyyy-MM-dd");
	public LectureItemView(Context context) {
		super(context);
	}

	public LectureItemView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public void bindItem(LectureDB lecture){
		tvOfferTitle.setText(lecture.getTitle());
		Log.d("time", "time:"+lecture.getTime());
		tvInfoDate.setText(formate.format(new Date(1000*Long.valueOf(lecture.getTime()))));
		setTag(lecture);
	}
	
}
